package test2;

import java.util.*;

/**
 * @Author Jun jie Yi
 * 2022/4/12 19:01
 */
public class Test4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; i++) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] arr = new int[n];
            //赋值
            for (int i1 = 0; i1 < n; i1++) {
                arr[i1] = sc.nextInt();
            }
            int num = handler(arr, k);
            System.out.println(num);
        }
    }

    public static int handler(int[] n, int k) {
        int num = 0;
        //1开始先拿 2，再 3，再 4
        List<int[]> pre = new ArrayList<>();
        for (int i = 0; i < n.length; i++) {
            int[] e = {i};
            pre.add(e);
        }
        //暂时存储
        List<int[]> temp = new ArrayList<>();
        for (int i = 1; i <= k; i++) {
            for (int j = 0; j < pre.size(); j++) {
                int[] arr = pre.get(j);
                int last = arr[arr.length - 1];
                for (int l = last + 1; l < n.length; l++) {
                    int[] ee = new int[arr.length + 1];
                    for (int la = 0; la < arr.length; la++) {
                        ee[la] = arr[la];
                    }
                    ee[arr.length] = l;
                    temp.add(ee);
                }
            }
            pre = temp;
            temp = new ArrayList<>();
        }

        for (int i = 0; i < pre.size(); i++) {
            int sum = 0;
            int[] arr = pre.get(i);
            for (int i1 = 0; i1 < arr.length; i1++) {
                sum += arr[i1];
            }
            if (sum % 2 == 0) {
                num++;
            }
        }
        return num;
    }
}
